package Test;
import MyQueue.*;

public class TestQueue extends Test{
    public void test() {
        MyCircularQueue queue = new MyCircularQueue(5);
        for(int i = 0; i < 5; i++) {
            queue.enQueue(i);
        }
        System.out.println(queue.enQueue(5));
        for(int i = 0; i < 3; i++) {
            System.out.print(queue.deQueue() + " ");
        }
        for(int i = 10; i < 50; i += 10) {
            queue.enQueue(i);
        }
        while(!queue.isEmpty()) {
            System.out.print(queue.deQueue() + " ");
        }
        System.out.println(queue.deQueue());
    }
    public static void testLinkedQueue() {
        MyLinkedQueue<Integer> queue1 = new MyLinkedQueue<Integer>();
        for(int i = 0; i < 20; i++) {
            queue1.offer(i);
            System.out.print(queue1.size() + " ");
        }
        System.out.println();
        System.out.println(queue1);
        for(int i = 0; i < 20; i++) {
            System.out.print(queue1.poll() + " ");
        }
    }

    public TestQueue(int num) {
        super(num);
    }

    public TestQueue() {
    }

    @Override
    public String toString() {
        return "TestQueue: " + num;
    }
}
